package com.tomcov.client.activities;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.tomcov.client.ClientFactory;
import com.tomcov.client.place.WelcomPlace;
import com.tomcov.client.view.LicenceView;

public class LicenceActivity extends AbstractActivity implements LicenceView.Presenter{

	private ClientFactory clientFactory;
	
	public LicenceActivity(ClientFactory clientFactory){
        this.clientFactory = clientFactory;	
	}
	
	@Override
	public void start(AcceptsOneWidget panel, EventBus eventBus) {
		LicenceView LicenceView = clientFactory.getLicenceView();
		LicenceView.getNext().addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				//TODO verifier OK();
				goTo(new WelcomPlace(null));	
			}
		});
		LicenceView.setPresenter(this);
        panel.setWidget(LicenceView.asWidget());
	}

	@Override
	public void goTo(Place place) {
		clientFactory.getPlaceController().goTo(place);		
		
	}

}
